'''
Created on 2017年9月12日

@author: zhangyanfeng
'''
from pyspark import SparkContext, SparkConf, rdd

sc = SparkContext( 'local', 'pyspark')
lines = sc.textFile("hdfs://192.168.13.131:9000/resources/hello.txt")

words = lines.flatMap(lambda x:x.split(" "))
result = words.map(lambda x:(x,1)).reduceByKey(lambda x,y: x+y)
print(result.collect())


